/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.storage.entity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 分类Entity
 */
@Table(name="biz_category", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="sort", attrName="sort", label="顺序"),
		@Column(name="name", attrName="name", label="名称", queryType=QueryType.LIKE),
		@Column(name="create_by", attrName="createBy", label="创建者", isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false)
	}, orderBy="a.update_date DESC"
)
public class Category extends DataEntity<Category> {
	
	private static final long serialVersionUID = 1L;
	private Integer sort;		// 顺序
	private String name;		// 名称
	private Integer activityNum;		// 活动数

	public Integer getActivityNum() {
		return activityNum;
	}

	public void setActivityNum(Integer activityNum) {
		this.activityNum = activityNum;
	}

	private Integer goodsNum;		// 商品数

	public Integer getGoodsNum() {
		return goodsNum;
	}

	public void setGoodsNum(Integer goodsNum) {
		this.goodsNum = goodsNum;
	}
	
	public Category() {
		this(null);
	}

	public Category(String id){
		super(id);
	}
	
	@NotNull(message="顺序不能为空")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@NotBlank(message="名称不能为空")
	@Length(min=0, max=255, message="名称长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}